home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / hdf / mac / h10srcst.hqx / Source / HyperHell Source / XCMD PICTREAD / pictxcmd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-06-28  |  2.2 KB  |  108 lines

  1. #include     <stdio.h>
  2. #include    <types.h>
  3. #include    <quickdraw.h>
  4. #include    <toolutils.h>
  5. #include    <fonts.h>
  6. #include    <events.h>
  7. #include    <windows.h>
  8. #include    <dialogs.h>
  9. #include    <menus.h>
  10. #include    <desk.h>
  11. #include    <textedit.h>
  12. #include    <scrap.h>
  13. #include    <segload.h>
  14. #include     <osutils.h>
  15. #include    <files.h>
  16. #include     <toolutils.h>
  17. #include    <packages.h>
  18. #include     <resources.h>
  19. #include     <HyperXCmd.h>
  20.  
  21. /******* TEKXCMD ********************************************/
  22.  
  23. pascal void pictxcmd(paramPtr)
  24.  
  25. XCmdBlockPtr    paramPtr;
  26.  
  27. {
  28.     FILE *fp;                                /* File pointer to tektronix file */
  29.     SFReply reply;
  30.     Point where;
  31.     long filetype[4];
  32.     char junk;
  33.     Str255 str, **res_str,**newcard,**copypic,**delete,**dragpic, **browse, **transparent;
  34.     long tlong;
  35.     PicHandle tpic;
  36.     Rect tr;
  37.     int i=1000, res_number;
  38.     int count;
  39.     Boolean cardFieldFlag;
  40.  
  41.     where.h = 150;
  42.     where.v = 120;
  43.     filetype[0]='TEXT';
  44.     filetype[1]='TEXT';
  45.     filetype[2]='TEXT';
  46.     filetype[3]='TEXT';
  47.     
  48.     res_str=(Str255 **)GetResource('STR ',101);
  49.     
  50.     if( res_str != 0L)
  51.         SFGetFile(&where, *res_str, 0L, -1, filetype, 0L, &reply);
  52.     if( !reply.good ) return;
  53.     
  54.     SetVol( 0L, reply.vRefNum);
  55.     ptoc(&reply.fName);
  56.     
  57.     newcard        =(Str255 **)    GetResource('STR ',102);
  58.     copypic        =(Str255 **)    GetResource('STR ',103);
  59.     dragpic        =(Str255 **)    GetResource('STR ',104);
  60.     browse         =(Str255 **)    GetResource('STR ',105);
  61.     transparent    =(Str255 **)    GetResource('STR ',107);
  62.     delete        =(Str255 **)    GetResource('STR ',108);
  63.     HLock(newcard);
  64.     HLock(copypic);
  65.     HLock(dragpic);
  66.     HLock(browse);
  67.     HLock(delete);
  68.         
  69.     res_number = OpenResFile(&reply.fName);
  70.  
  71.     while( tpic=GetResource('PICT',i) )
  72.     {
  73.     tlong=ZeroScrap();                                     
  74.     HLock(tpic);                                        
  75.     tlong=PutScrap(GetHandleSize(tpic),'PICT',*tpic);
  76.     SendCardMessage(paramPtr,*newcard);
  77.     SendCardMessage(paramPtr,*copypic);
  78.     SendCardMessage(paramPtr,*transparent);
  79.     HUnlock(tpic);        
  80.     ReleaseResource(tpic);
  81.     i++;
  82.     }
  83.     SendCardMessage(paramPtr,*delete);
  84.     SendCardMessage(paramPtr,*browse);
  85.     CloseResFile(res_number);
  86.     
  87. }                                        
  88. /* END tekxcmd */
  89.  
  90. /* Thanks to Tim K. for this function */
  91. ptoc(s)
  92.     char *s;
  93. {
  94.     register int len;
  95.     
  96.     len = *s+1;
  97.     
  98.     while( --len ) 
  99.     {
  100.         *s = *(s+1);
  101.         s++;
  102.     }
  103.     
  104.     *s = '\0';
  105. }
  106.  
  107. #include <XCmdGlue.inc.c>
  108.